//获取交易类型
$('.jiaoyi_lx .jiaoyi_sx').on('click',function(){
	var dib = $(this).text();
	tradeType=$(this).find("a").attr('data-id');
	$('.jyshuxing').html(dib);
	p=1;
	tiaozhuan(p);
})

//	获取地址栏参数
function GetQueryString(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if(r != null) return unescape(r[2]);
	return null;
}
 var zzid = GetQueryString("acid");
 var you=zzid;
//财务记录列表
var p=1;
var tradeType='0';

function tiaozhuan(p){
	var pageSize=$('.ui-select-pagesize').val();
	var d={};
	d.page=p;
	d.pageSize=pageSize;
//	d.createTime=createTime;
//	d.endTime=endDate;
	d.tradeType=tradeType;
	d.adverId=you;

	$.ajax({
		url: url + "/sys/fiInfoCom/queryRecordPage",
		type: 'POST',
		//		参数需转为字符串
		data: JSON.stringify(d),
		//		json跨域
		dataType: 'json',
		//		contentType类型为json
		contentType: "application/json",

		//		请求头加上X-Token 
		 beforeSend: function(XMLHttpRequest) {
			//		token 为页面所获取
			   
			XMLHttpRequest.setRequestHeader("X-Token", token); 
		},
		useDefaultXhrHeader: false,
		success: function(result) {
			console.log(result);
			if(result.code == '0') {
				var data=result.data.rows;
				var html="";
				for(var i in data){
					html += '<tr class="ng-scope"><td  class="ng-binding">'+data[i].createTime+'</td>';
					html += '<td  class="ng-binding">'+data[i].adComId+'</td><td  class="ng-binding">'+data[i].adComName+'</td>';
					if(data[i].tradeType == '0'){
						html += '<td  class="ng-binding">全部类型</td>';
					}else if(data[i].tradeType == '3'){
						html += '<td  class="ng-binding">充值</td>';
					}else if(data[i].tradeType == '4'){
						html += '<td  class="ng-binding">转出</td>';
					}else{
						html += '<td  class="ng-binding">利润</td>';
					}
					html += '<td  class="ng-binding">'+data[i].amount+'</td></tr>';
				}
				$(".tradeinfor_list").html(html);
				var r=result.data.total;
					paging(p,pageSize,r);
			} else {
				isErr(result);
			}
		},
		err: function(err) {
			layer.msg("请求失败");
		}
		
	});
}
tiaozhuan(p);
